4 // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
6 // The use and distribution terms for this software are contained in the file
7 // named license.txt, which can be found in the root of this distribution.
8 // By using this software in any fashion, you are agreeing to be bound by the
9 // terms of this license.
11 // You must not remove this notice, or any other, from this software.
16 // Makes a PropertyInfo look like a FieldInfo for use in compiled with statements
18 namespace Microsoft
.JScript
{
21 using System
.Globalization
;
22 using System
.Reflection
;
24 internal sealed class JSPropertyField
: JSField
{
25 internal PropertyInfo wrappedProperty
;
26 internal Object wrappedObject
;
28 internal JSPropertyField(PropertyInfo field
, Object obj
){
29 this.wrappedProperty
= field
;
30 this.wrappedObject
= obj
;
33 public override String Name
{
35 return this.wrappedProperty
.Name
;
39 public override FieldAttributes Attributes
{
41 return FieldAttributes
.Public
;
45 public override Type DeclaringType
{
47 return this.wrappedProperty
.DeclaringType
;
51 public override Type FieldType
{
53 return this.wrappedProperty
.PropertyType
;
57 public override Object
GetValue(Object obj
){
58 return this.wrappedProperty
.GetValue(this.wrappedObject
, new Object
[0]);
61 public override void SetValue(Object obj
, Object
value, BindingFlags invokeAttr
, Binder binder
, CultureInfo locale
){
62 this.wrappedProperty
.SetValue(this.wrappedObject
, value, invokeAttr
, binder
, new Object
[0], locale
);